import tkinter as tk
from tkinter import filedialog
import subprocess


def upload_file():
    file_path = filedialog.askopenfilename(filetypes=[("Excel Files", "*.xlsx")])
    if file_path:
        try:
            subprocess.check_call(['python3.9', 'scoreCorrelation.py', file_path])
            #可能需要根据python版本更改
        except subprocess.CalledProcessError as e:
            print("An error occurred:", e)


def main():
    root = tk.Tk()
    root.title("PearsonCorrelationForScore分析")
    root.geometry("300x100")

    upload_button = tk.Button(root, text="上传文件", command=upload_file)
    upload_button.pack(pady=20)

    root.mainloop()


if __name__ == "__main__":
    main()
